package com.fyb.controller;

import com.fyb.connotation.Idempotent;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author：MR.FANG
 * @name：TestController
 * @Date：2025/6/10 上午9:33
 */
@RestController
@RequestMapping("/idempotent/")
public class TestController {

    @GetMapping("/get")
    @Idempotent(key = "#key", expireTime = 3, info = "请勿重复查询")
    public String get(String key) throws Exception {
        Thread.sleep(2000L);
        return "success";
    }

    @GetMapping("/noKey")
    @Idempotent(expireTime = 3, info = "请勿重复查询")
    public String noKey() throws Exception {
        Thread.sleep(2000L);
        return "success";
    }

}
